<?
if ($page < 1) {
	$page = 0;
} else {
	$links[] = "<a href='directory.php?page=".($page-1)."'>Previous</a>";
}

$global_dbh = mysql_connect("localhost","username","password");
mysql_select_db("mydatabasename", $global_dbh);

$query = "SELECT * FROM `directory` ORDER BY `ID` DESC LIMIT ".($page*10).", 11";
$result = mysql_query($query, $global_dbh);
$cnt = mysql_num_rows($result);

if ($cnt > 10) {
	$cnt = 10;
	$links[] = "<a href='directory.php?page=".($page+1)."'>Next</a>";
}

echo @implode(" | ",$links);

for ($i=0; $i<$cnt; $i++) {
	$row = mysql_fetch_array($result);
	echo "<a href='{$row["URL"]}'>{$row["Title"]}</a><P>";
}

echo @implode(" | ",$links);
?>